<template>
  <div class="auditlose" v-loading="isOutTime">
    <Table
      :name="{table,isbtn,pageNum,pageSize,pageLength}"
      @handleSelectionChange="handleSelectionChange"
      @cause="cause"
      @amend="amend"
      @handleSizeChange="handleSizeChange"
      @handleCurrentChange="handleCurrentChange"
      @batchdelete="batchdelete"
      v-if="isShow"
    ></Table>
    <!-- 失败原因 -->
    <el-dialog title="失败原因" :visible.sync="lose" width="25%">
      <p class="cause">{{loseyy}}</p>
      <span slot="footer" class="dialog-footer">
        <el-button @click="lose = false">取 消</el-button>
        <el-button type="primary" @click="lose = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import Table from "@/components/tableStyle/Table";

export default {
  data() {
    return {
      // 数据
      table: [],
      //预约成功：待定
      //审核通过：2
      //审核失败：3
      //审核中：1
      isbtn: 3,
      //分页
      pageNum: 1,
      pageSize: 10,
      pageLength: 0,
      //失败原因
      lose: false,
      loseyy: "",
      //判断是否超时
      isOutTime: true,
      //判断数据是否获取到
      isShow: false,
    };
  },
  components: { Table },
  methods: {
    //单选全选
    handleSelectionChange(value) {
      // ////console.log(value);
    },
    //失败原因
    cause(index, row) {
      //console.log(row);
      this.lose = true;
      this.loseyy = row.corrections;
    },
    //修改
    amend(index, row) {
      //console.log(index, row);
      this.$store.commit("setStateJeg", true);
      this.$store.commit("setStoreId", row.id);

      this.$router.push({
        path: "/business/allBusiness/register",
        query: {
          id: row.classId,
          data_id: row.id,
        },
      });
    },
    //分页
    handleSizeChange(val) {
      this.pageSize = val;
      this.interface();
    },
    handleCurrentChange(val) {
      this.pageNum = val;
      this.interface();
    },
    //删除
    batchdelete(val) {
      // ////console.log(val);
    },
    //接口
    interface() {
      this.$http
        .post("/trademark/proPublic/findUserStatus", {
          status: this.isbtn,
          // userId: Number(this.$store.state.userId),
          pageNum: this.pageNum,
          pageSize: this.pageSize,
        })
        .then((res) => {
          ////console.log(res);
          if (res.data.code !== 200) {
            this.$message.error("获取数据失败");
            this.isOutTime = false;
          } else {
            this.pageLength = res.data.data.total;
            this.table = res.data.data.list;
            this.isShow = true;
            this.isOutTime = false;
            // ////console.log(this.isShow);
          }
        })
        .catch((err) => {
          //this.$message.error("服务器崩溃！");
          this.isShow = true;
          this.isOutTime = false;
        });
    },
  },
  mounted() {
    this.interface();
  },
};
</script>

<style lang="less" scoped>
.auditlose {
  .cause {
    color: #f5222d;
  }
}
</style>